<?php

namespace Sffi\ElementPlus;

use Sffi\ElementPlus\base\EntityToArray;
use Sffi\ElementPlus\ElForm\FormItem;
use Sffi\ElementPlus\ElRule\Rule;

class ElForm
{
    use EntityToArray;
    /**
     * @var FormItem[] $columns
     */
    protected array $columns = [];
    protected array $rule = [];

    public function addColumn(FormItem $column): ElForm
    {
        $this->columns[] = $column;
        return $this;
    }

    public function addRule(Rule $rule): self
    {
        $this->rule[$rule->getTitle()] = $rule->__toArray();
        return $this;
    }
}